#include <stdio.h>

void swapArrays(int A[], int B[], int n) {
    int temp;
    for (int i = 0; i < n; i++) {
        temp = A[i];
        A[i] = B[i];
        B[i] = temp;
    }
}

void printArray(int arr[], int n) { //arr[] = *arr
    for (int i = 0; i < n; i++) {
        printf("%d ", arr[i]);
    }
    printf("\n");
}

int main(void) {
    int A[5] = {1, 2, 3, 4, 5};
    int B[5] = {6, 7, 8, 9, 10};
    int n = 5;

    printf("交换前:\n");
    printf("A: "); printArray(A, n);
    printf("B: "); printArray(B, n);

    swapArrays(A, B, n);  // 交换两个数组

    printf("\n交换后:\n");
    printf("A: "); printArray(A, n);
    printf("B: "); printArray(B, n);

    return 0;
}
